<template>
  <div class="search">
    <input type="text" placeholder="输入任务名称" v-model="taskName">
    <span @click="newadd()">新增</span>
  </div>
</template>

<script>
export default {
    data(){
        return{
            taskName:''
        }
    },
    methods:{
        newadd(){
            if (this.taskName) {
                this.$store.commit('addTask',this.taskName)
                this.taskName=''
            }else{
                alert('请输入任务名称')
            }
        }
    }
}
</script>

<style lang="scss" scoped>

.search input{
    height: 8vw;
    width: 70vw;
    border: none;
    outline: none;
    padding-left: 5vw;
    background: #f5f5f5;
    margin-right: 5vw;
}
.search span{
    width: 10vw;
    text-align: center;
    color: green;
}
</style>